﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DoeCSLogin;

namespace DoeCsLoginTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            DoeCSLogin.DoeCSLogin dc = new DoeCSLogin.DoeCSLogin();
            string Loin_Name=dc.Doe_Login();
            MessageBox.Show(Loin_Name == "" ? "Not Login yet" : "Have Login,And Login User Name is:   " + Loin_Name);
        }  
        private void button2_Click(object sender, EventArgs e)
        {
            DoeCSLogin.DoeCSLogin dc = new DoeCSLogin.DoeCSLogin();
            MessageBox.Show(dc.Logout()==true?"Login Out True":"Login Out False");
        }
        private void button3_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tb_name.Text.Trim()) || string.IsNullOrEmpty(tb_pwd.Text.Trim()))
            {
                MessageBox.Show("Login Name and Login Pwd Cant't Null or Empty!");
                return;
            }
            DoeCSLogin.DoeCSLogin dc = new DoeCSLogin.DoeCSLogin();
            try
            {
                MessageBox.Show(dc.Login(tb_name.Text.Trim(), tb_pwd.Text.Trim()) == true ? "Loin In True" : " Login In False");
            }
            catch
            {
                MessageBox.Show("Open ID Web Is Not Privide Service");
            }
           
        }
      
    }
}